/**
 * Project: d20Engine
 * Created: Oct 21, 2006 by bebopJMM
 */
package org.rollinitiative.d20.entity;

import org.rollinitiative.d20.Adjustment;
import org.rollinitiative.d20.AdjustmentCategory;

import javax.xml.bind.annotation.*;

/**
 * Enumeration of the sizes that an entity may be classified as. The modifiers comply to the D20
 * SRD.
 * 
 * @see http://www.d20srd.org/srd/combat/combatStatistics.htm
 * 
 * TODO Refactor static methods to return Adjustment Data objects instead of Adjustment objects
 * 
 * @author bebopjmm
 * @since sprint-0.1
 */
@XmlType(name = "SizeEnum", namespace = "java:org.rollinitiative.d20.entity")
public enum Size {
    FINE((short) 8, (short) -16), DIMINUTIVE((short) 4, (short) -8), TINY((short) 2, (short) -4), SMALL(
            (short) 1, (short) -2), MEDIUM((short) 0, (short) 0), LARGE_TALL((short) -1, (short) 2), LARGE_LONG(
            (short) -1, (short) 2), HUGE_TALL((short) -2, (short) 4), HUGE_LONG((short) -2,
            (short) 4), GARGANTUAN_TALL((short) -4, (short) 8), GARGANTUAN_LONG((short) -4,
            (short) 8), COLOSSAL_TALL((short) -8, (short) 16), COLOSSAL_LONG((short) -8, (short) 16);

    private final short combatMod;

    private final short grappleMod;


    Size(short combatModifier, short grappleModifier)
    {
        combatMod = combatModifier;
        grappleMod = grappleModifier;
    }


    public short getCombatModifier()
    {
        return combatMod;
    }


    public short getGrappleModifier()
    {
        return grappleMod;
    }


    public static Adjustment generateCombatAdjustment(Size size)
    {
        return new Adjustment(AdjustmentCategory.INHERENT, size.combatMod, "size.combat");
    }


    public static Adjustment generateGrappleAdjustment(Size size)
    {
        return new Adjustment(AdjustmentCategory.INHERENT, size.grappleMod, "size.grapple");
    }

}
